package com.aipodcast.webbackend.utils;

import com.aipodcast.webbackend.config.model.ApiResponse;
import com.aipodcast.webbackend.config.model.ApiResponseCode;

/**
 * @author RedStar
 * @date 2025/9/22 22:14
 * @description
 */
public class ApiResponseUtils {
    
    // 成功的响应
    public static <T> ApiResponse<T> success(T data) {
        return new ApiResponse<>(ApiResponseCode.SUCCESS, "请求成功", data);
    }

    // 无数据的成功响应
    public static <T> ApiResponse<T> success() {
        return new ApiResponse<>(ApiResponseCode.SUCCESS, "请求成功", null);
    }

    // 错误的响应
    public static <T> ApiResponse<T> error(String message) {
        return new ApiResponse<>(ApiResponseCode.ERROR, message, null);
    }

    // 自定义的错误响应
    public static <T> ApiResponse<T> error(int code, String message) {
        return new ApiResponse<>(code, message, null);
    }
}
